package com.orange.feign.controller;

import com.orange.feign.api.ServiceFeign;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FeignController {

    // 注入服务eureka-orange的Feign客户端接口ServiceFeign

    private ServiceFeign serviceFeign;

    public FeignController(ServiceFeign serviceFeign) {
        this.serviceFeign = serviceFeign;
    }


    @GetMapping("/feign/{name}")
    public String sayHello(@PathVariable String name){
        // 调用Feign客户端sayHelloFromService的接口
        return this.serviceFeign.sayHelloFromServiceFeignTwo(name);
    }
}
